import React from 'react';
import { microModule } from '@alife/yunxiao-common';
import { Link, navigate } from 'utils/router';
import { getFeature } from 'utils/features';

const { MicroModule } = microModule;

/**
 * 微前端模块的容器定义，位于「工作台-菜单」
 */
const ProjectWikiContainer = () => {
  const { url } = getFeature('microModule.project.wiki');

  if (!url || url.length === 0) return null;
  return (
    <MicroModule
      moduleInfo={{
        name: 'ProjectWikiContainer',
        url,
      }}
      navigate={navigate}
      Link={Link}
      onCreate={(v) => alert(`主应用成功获取子应用的用户输入内容：${v}`)}
      onClose={() => console.log('close')}
      contextDemo={window.FORCE.user}
      prefix="yx-"
    />
  );
};

export default React.memo(ProjectWikiContainer);
